package com.chen.controller;

import com.chen.pojo.JobOption;
import com.chen.pojo.Result;
import com.chen.pojo.StudentOption;
import com.chen.service.ReportService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;
import java.util.Map;

@Slf4j
@RestController
@RequestMapping("/report")
public class ReportController {
    @Autowired
    private ReportService reportService;
    /*
    * 获取员工职位人数
     */
    @GetMapping("/empJobData")
    public Result getEmpJobData() {
        log.info("获取员工职位人数");
        JobOption jobData =reportService.getJobData();
        return Result.success(jobData);
    }
    @GetMapping("/empGenderData")
    public Result getEmpGenderData() {
        log.info("统计员工性别信息");
        List<Map<String,Object>> data=reportService.getEmpGenderData();
        return Result.success(data);

    }
    @GetMapping("/studentDegreeData")
    public Result getStudentDegreeData() {
        log.info("统计学生学历信息");
        List<Map<String,Object>> data=reportService.getStudentDegreeData();
        return Result.success(data);
    }
    /*
    统计班级人数信息
     */
    @GetMapping("/studentCountData")
    public Result getStudentCountData() {
        log.info("统计班级人数信息");
        StudentOption studentData=reportService.getStudentCountData();
        return Result.success(studentData);
    }
}
